package com.zhaiweijia.service.impl;

import java.util.List;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhaiweijia.bean.User;
import com.zhaiweijia.dao.UserMapper;
import com.zhaiweijia.service.UserService;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserMapper userMapper;

	@Override
	public PageInfo<User> list(Integer pageNum, Integer pageSize, User user) {
		//分页参数
		PageHelper.startPage(pageNum, pageSize);
		
		//查询数据
		List<User> list = userMapper.list(user);
		
		return new PageInfo<User>(list);
	}

	@Override
	public boolean updateLocked(User user) {
		return userMapper.updateLocked(user);
	}

	@Override
	public List<User> checkUsername(User user) {
		return userMapper.checkUsername(user);
	}

	@Override
	public void register(User user) {
		userMapper.register(user);
	}

	@Override
	public User login(User user) {
		return userMapper.login(user);
	}
}
